/**
 * @param {number[]} nums
 * @return {number[]}
 */
 var buildArray = function(nums) {
    const ans = new Array(nums.length).fill(0)
    for(let i = 0, len = nums.length; i<len; i++){
        ans[i] = nums[nums[i]]
    }
    return ans
};